import cv2
import os

fps = 24
size = (640, 480)
videowriter = cv2.VideoWriter("test.mp4", cv2.VideoWriter_fourcc(*'mp4v'), fps, size)
path = "./images/"
for i in range(1,len(os.listdir(path)[0:150])+1):
    img = cv2.imread(path+"%d.jpg"%i)
    videowriter.write(img)